-
Couldn't load subscription status.
- Fork 22
early skip if quantity of tests not sufficient for original baseline #517
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
early skip if quantity of tests not sufficient for original baseline #517
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
…arly-skip-if-insufficient-number-of-tests-passed`) Here is the optimized code (with all comments preserved except for the lines that are modified). The key optimizations are. 1. **Avoid initialize-all-keys upfront:** We only create report keys as needed for `test_result.test_type`, skipping the expensive full loop over `TestType`. 2. **Combine report data gathering and counting into a single loop:** While collecting report, simultaneously sum pass count and track replay passes—instead of iterating again in `quantity_of_tests_critic`. 3. **Use local variables and dict.setdefault:** This simplifies branching and dictionary operations. 4. **Reduce duplicative dictionary lookups** and avoid construction of unused test type results. **Summary of improvements:** - Removed unnecessary initialization and dictionary work on unneeded types. - Only accumulate/report for types/tests actually present (saves iterations/allocations). - Inline pass counting and special-case REPLAY_TEST success counting to avoid a second dict walk. - All logic and return values of functions are preserved. - Comments are unchanged except for the lines actually optimized.
⚡️ Codeflash found optimizations for this PR📄 76% (0.76x) speedup for
|
PR Type
Enhancement
Description
Early-skip baseline on insufficient test count
Integrate
quantity_of_tests_criticin checkUpdate critic signature to support baseline
Import
OriginalCodeBaselinein criticChanges diagram
Changes walkthrough 📝
function_optimizer.py
Add tests quantity check to baseline skipcodeflash/optimization/function_optimizer.py
quantity_of_tests_criticto baseline skip conditioncritic.py
Support baseline in tests quantity criticcodeflash/result/critic.py
OriginalCodeBaselineunder TYPE_CHECKINGquantity_of_tests_criticsignature for baseline